LATEX=pdflatex
LATEXARGS=-halt-on-error
DOCNAME=riscboy_doc
PDFVIEWER=xdg-open

all: $(DOCNAME).pdf

$(DOCNAME).pdf: $(wildcard *.tex) $(wildcard waves/*.svg)
	make -C waves
	$(LATEX) $(LATEXARGS) $(DOCNAME).tex
	$(LATEX) $(LATEXARGS) $(DOCNAME).tex

clean:
	rm -f $(DOCNAME).log *.aux $(DOCNAME).toc $(DOCNAME).lof $(DOCNAME).sync.gz $(DOCNAME).pdf $(DOCNAME).out
	make -C waves clean

view: $(DOCNAME).pdf
	$(PDFVIEWER) $(DOCNAME).pdf

